Programming apparatus of a visual inspection program

ABSTRACT

A programming apparatus supports a user to program a visual inspection program used in a visual inspection apparatus. A plurality of standard inspection flows corresponding to kinds of products to be inspected, a plurality of image processing algorithms and a plurality of inspection parameters used in the visual inspection of the product are previously memorized. The user prepares a plurality of image data of defective units and non-defective units of the product which he wishes to inspect, and programs a provisional visual inspection program configured by the standard inspection flow corresponding to the kind of the product which is selected by the user, the image processing algorithms and the inspection parameters selected by following a guidance of the standard inspection flow. The provisional visual inspection program is evaluated by using the sample image data whether it is proper or improper for inspecting the product.

TECHNICAL FIELD

[0001] The present invention relates to an apparatus for programming avisual inspection program used in a visual inspection apparatus forinspecting an appearance of a product conveyed on a manufacturing linethereof.

BACKGROUND ART

[0002] Conventionally, a visual inspection apparatus is used forinspecting an appearance of a product in a manufacturing processes. Inthe conventional visual inspection apparatus, a visual image of anappearance of a product is taken by a camera using an image wacquisition device such as a CCD (Charge Coupled device), and an imagedata corresponding to the visual image of the product outputted from thecamera is processed by following a predetermined visual inspectionprogram so that it is judged whether the appearance of the productsatisfies a predetermined quality or not.

[0003] Prior to the actual visual inspection of the products, the visualinspection program and the parameters are adjusted in a manner so thatthe appearance of the products are precisely judged as defective ornon-defective by using sample image data of defective units andnon-defective units which are previously prepared by a user of thevisual inspection apparatus.

[0004] There are infinite varieties in the products to be inspected, sothat inspection items, inspection methods, and inspection parameterscannot be standardized. Thus, the visual inspection program generallyhas an exclusive use with respect to each product to be inspected. Whenthe kind of the product to be inspected is changed, it is necessary toprepare a new exclusive visual inspection program suitable forinspecting the new product. Furthermore, it demands an expert knowledgewith respect to a computer such as the C-language to program the visualinspection program, so that the visual inspection program is generallyprogrammed by a programmer in a vendor of the visual inspectionapparatus.

[0005] On the other hand, the Publication Gazette of Unexamined JapanesePatent Application Sho 63-191278 shows a conventional user supportmethod in an interactive image processing system by which the userunaccustomed to the image processing algorithm can easily execute theimage processing. In the interactive image processing system, theknow-how of an expert in the art of the image processing with respect tothe usage or the operational specification of the image processingalgorithms is memorized in a memory. When the user is required to selecta sub-function of the image processing or to set a parameter while theimage processing algorithm is executed, the user is supported bydisplaying the explanation of judging standard for selecting thesub-function or the parameter on a monitor display, or supported byautomatically selecting the sub-function or the parameter by using theknow-how of the expert in the memory.

[0006] The conventional user support method can support the user exactlyfor selecting the most suitable sub-function or parameter in the imageprocessing. It, however, is difficult to support the user of the visualinspection apparatus for programming the visual inspection programeasily, even when the conventional user support method is applied to themethod for forming the visual inspection program. Since the visualinspection program has substantially the exclusive use with respect tothe product to be inspected, the know-how of the expert can only beapplied to a specific case. Thus, it is substantially impossible thatthe user unaccustomed to the expert knowledge of the computer can easilyprogram the visual inspection program suitable for the visual inspectionof the desired product.

[0007] Furthermore, when the product to be inspected is changed, theimage data to be processed in the visual inspection program will bedifferent at all. If the inspection parameters used in the visualinspection program are not based on the actual image data of the productto be inspected, the reliability and the precision of the visualinspection will be reduced. Still furthermore, if the inspection resultby the image processing steps in the visual inspection are notpreviously confirmed, the results of the visual inspection becomesunreliable.

DISCLOSURE OF INVENTION

[0008] An objective of the present invention is to provide a programmingapparatus of a visual inspection program used in a visual inspectionapparatus, by which the user of the visual inspection apparatus caneasily program the visual inspection program suitable for an object (ora product) to be inspected. Another objective of the present inventionis to provide a visual inspection apparatus by which the reliable andprecise visual inspection suitable for inspecting the object can beexecuted. Still another objective of the present invention is to providea method for programming a visual inspection program by which the userof the visual inspection apparatus can easily program the visualinspection program suitable for the object to be inspected. Stillanother objective of the present invention is to provide a program forprogramming the visual inspection program, which can be installed into aknown personal computer so that the known personal computer can serve asthe programming apparatus of the visual inspection program. Stillanother objective of the present w invention is to provide a recordingmedium memorizing the program for programming the visual inspectionprogram.

[0009] A programming apparatus of a visual inspection program inaccordance with the present invention comprises: an image data memoryfor memorizing a plurality of sample image data of defective units andnon-defective units of an object to be inspected which are previouslyprepared by a user; an algorithm memory for memorizing a plurality ofimage processing algorithms with respect to each inspection item; astandard flow memory for memorizing at least one standard inspectionflow and a plurality of inspection parameters with respect to each kindof object to be inspected; a display unit having a monitor display fordisplaying at least a guidance of a programming steps; an input unit bywhich a user inputs or selects a kind of an object which he wishes toinspect, selects at least one image processing algorithm and at leastone inspection parameter used in a standard inspection flowautomatically selected corresponding to the kind of the object; and aninspection processor for controlling whole of the programming apparatusand for executing the following processes.

[0010] The inspection processor displays the guidance of the programmingsteps, and automatically selects a standard inspection flow from thestandard flow memory corresponding to the input or selection of the kindof the object by the user. Subsequently, the inspection processor readsout at least one image processing algorithm from the algorithm memoryand at least one inspection parameter from the standard flow memorycorresponding to the selection by the user, so that the inspectionprocessor programs a provisional visual inspection program by using thestandard inspection flow, the image processing algorithm(s) and theinspection parameter(s). When the provisional visual inspection programis programmed, the inspection processor processes the sample image dataof defective units and non-defective units by following the provisionalvisual inspection program, and executes the visual inspection whether anappearance of the object with respect to each sample image data isdefective or non-defective using processed image data. The inspectionprocessor displays the results of the visual inspection of the sampleimage data on the monitor display of the display unit. Furthermore, theinspection processor requires the user whether the provisional visualinspection program is proper or improper. When the user is satisfied bythe result of the visual inspection of the sample image data, theinspection processor outputs the provisional visual inspection programis outputted as a final visual inspection program used in the visualinspection apparatus. Alternatively, when the user is not satisfied bythe result of the visual inspection of the sample image data, theinspection processor further requires the user to change at least oneimage processing algorithm and/or at least one inspection parameteruntil the provisional visual inspection program will be judged proper.

[0011] By such a configuration, the user of the visual inspectionapparatus unaccustomed to the programming language and/or the imageprocessing can easily program the visual inspection program suitable forinspecting the optional object he wishes to inspect. Especially, thesample image data of the defective units and non-defective units of theobject are actually inspected by using the provisional visual inspectionprogram, so that it can easily be judged whether the provisional visualinspection program is proper or improper by considering the result ofthe inspection. Furthermore, when the provisional visual inspectionprogram is judged improper, it is possible to compensate the provisionalvisual inspection program until it is judged proper by changing theimage processing algorism and/or the inspection parameters.

[0012] A visual inspection apparatus in accordance with the presentinvention comprises: an image acquisition unit for taking a visual imageof an object conveyed on a manufacturing line thereof; and a removingunit for removing or for instructing to remove an object judgeddefective from the manufacturing line, further to the above-mentionedfunction of the programming apparatus of the visual inspection program.

[0013] By such a configuration, the user of the visual inspectionapparatus can directly program the visual inspection program into amemory of the visual inspection apparatus. Thus, when the object to beinspected is changed, the user can easily change the visual inspectionprogram suitable for inspecting the optional object he wishes toinspect.

[0014] A method for programming a visual inspection program inaccordance with the present invention comprises the steps of: memorizinga plurality of image processing algorithm with respect to eachinspection item, at least one standard inspection flow and a pluralityof inspection parameters with respect to each kind of object to beinspected; requiring the user to input or to select a kind of the objectto be inspected; requiring the user to input a plurality of sample imagedata of defective units and non-defective units of objects to beinspected; automatically selecting a standard inspection flowcorresponding to the kind of the object among the previously memorizedstandard inspection flows; requiring the user to select at least oneimage processing algorithm and at least one inspection parameter amongthe previously memorized image processing algorithms and the inspectionparameters by following the selected standard inspection flow;programming a provisional visual inspection program using the electedstandard inspection flow, the image processing algorithm(s) and theinspection parameter(s); reading out the sample image data one by one;executing visual inspection of the sample image data by following theprovisional visual inspection program; executing the visual inspectionwith respect to each sample image data whether an appearance of theobject is defective or non-defective; and displaying the result of thejudgment of the visual inspection of the sample image data on themonitor display.

[0015] By such a configuration, the user unaccustomed to the programminglanguage and/or the image processing can easily program the visualinspection program suitable for inspecting the optional object he wishesto inspect by following the requirement in the programming method.Furthermore, the visual inspection program programmed by this method isevaluated by actually executing the visual inspection with respect tothe sample image data, so that the visual inspection program used in thevisual inspection apparatus becomes reliable and precise.

[0016] A program for programming the visual inspection program inaccordance with the present invention comprises the steps of: requiringa user to input or to select a kind of an object to be inspected;automatically selecting a standard inspection flow among a plurality ofstandard inspection flows previously inputted corresponding to the inputor selection of the kind of the object by the user; requiring the userto input at plurality of sample image data of the object including atleast one defective unit and at least one non-defective unit; requiringthe user to select at least one image processing algorithm and at leastone inspection parameter among a plurality of image processingalgorithms and a plurality of inspection parameters previously inputted;programming a provisional visual inspection program using the selectedstandard inspection flow, the image processing algorithm(s) and theinspection parameter(s); reading the sample image data one by one;executing the visual inspection with each sample image data by followingthe provisional visual inspection program; judging whether the sampleimage data is defective or non-defective; and displaying the result ofthe judgment with respect to all the sample image data on a monitordisplay.

[0017] By such a configuration, when the program is installed into aknown personal computer, the personal computer can be used as theprogramming apparatus of the visual inspection apparatus in accordancewith the present invention. The program can be downloaded from a serverof the vender supplying the visual inspection apparatus, so that theuser can easily program the visual inspection program suitable for theoptional object which the user wishes to inspect, at any time.

[0018] A recording medium in accordance with the present inventionmemorizes at least one standard inspection flow with respect to eachkind of object to be inspected, a plurality of image processingalgorithm with respect to each inspection item, a plurality inspectionparameters and a program for programming a visual inspection program.The program comprises the steps of: requiring a user to input or toselect a kind of the object to be inspected; requiring the user to inputa plurality of sample image data of defective units and non-defectiveunits of objects to be inspected which are previously prepared by auser; automatically selecting a standard inspection flow correspondingto the kind of the object among the previously memorized standardinspection flows; requiring the user to select at least one imageprocessing algorithms and at least one inspection parameter among thepreviously memorized image processing algorithms and the inspectionparameters by following the selected standard inspection flow;programming a provisional visual inspection program using the selectedstandard inspection flow, the image processing algorithm(s) and theinspection parameter(s); reading out the sample image data one by onefor executing visual inspection by following a provisional visualinspection program configured by the elected standard inspection flow,the image processing algorithm(s) and the inspection parameter(s);executing the visual inspection with respect to each sample image datawhether an appearance of the object is defective or non-defective byfollowing the provisional visual inspection program; and displaying theresult of the judgment of the visual inspection of the sample image dataon the monitor display.

[0019] By such a configuration, the user already has the visualinspection apparatus can easily program the visual inspection programsuitable for the optional object which the user wishes to inspect, afterthe purchase of the visual inspection apparatus.

BRIEF DESCRIPTION OF DRAWINGS

[0020]FIG. 1 is a block diagram for showing a configuration of aprogramming apparatus of a visual inspection program in accordance witha first embodiment of the present invention;

[0021]FIG. 2 is a drawing schematically for showing contents of eachblock of the programming apparatus in the first embodiment;

[0022]FIG. 3 is a block diagram for showing examples of kinds ofproducts to be inspected in the first embodiment;

[0023]FIG. 4 is a drawing for showing an example of a display of astandard inspection flow on a display unit of the programming apparatusin the first embodiment;

[0024]FIG. 5 is a block diagram for showing folders and examples ofimage data of defective units memorized in the folders in the firstembodiment;

[0025]FIG. 6 is a block diagram for showing an example of folders intowhich image data of defective units and non-defective units are sortedin the first embodiment;

[0026]FIG. 7 is a block diagram for showing another example of foldersinto which image data corresponding to illumination methods in the firstembodiment;

[0027]FIG. 8 is a block diagram for showing examples of surface natureor materials of the object to be inspected in the first embodiment;

[0028]FIG. 9 is a block diagram for showing examples of surface colorsof the products to be inspected in the first embodiment;

[0029]FIGS. 10A and 10 B are drawings for showing a flowchart ofprogramming steps of the visual inspection program in the firstembodiment;

[0030]FIGS. 11A and 11B are drawings for showing images of a productdisplayed on the display unit of the programming apparatus in the firstembodiment by which a region to be inspected on a surface of the productcan be selected;

[0031]FIG. 12 is a drawing for showing images of the product before andafter image processing in the programming steps of the visual inspectionprogram in the first embodiment;

[0032]FIGS. 13A to 13C are drawings for showing a flowchart of a firstmodification of the programming steps of the visual inspection programin the first embodiment;

[0033]FIGS. 14A to 14C are drawings for showing a flowchart of a secondmodification of the programming steps of the visual inspection programin the first embodiment;

[0034]FIG. 15 is a drawing for showing a table of inspection parametersand specific values thereof in the second modification of theprogramming steps of the visual inspection program in the firstembodiment;

[0035]FIGS. 16A to 16C are drawings for showing a flowchart of a thirdmodification of the programming steps of the visual inspection programin the first embodiment;

[0036]FIG. 17 is a drawing for showing a table of judgments of sampleimage data used in the programming steps of the visual inspectionprogram with respect to respective image processing algorithms in thefirst embodiment;

[0037]FIG. 18 is a block diagram for showing a system configured by aprogramming apparatus of a visual inspection program and a visualinspection apparatus in accordance with a second embodiment of thepresent invention; and

[0038]FIG. 19 is a block diagram for showing a configuration of a visualinspection apparatus having a function of a programming apparatus of avisual inspection program in accordance with a third embodiment of thepresent invention.

BEST MODE FOR CARRYING OUT THE INVENTION

[0039] A first embodiment of the present invention is described. Aprogramming apparatus of a visual inspection program in accordance withthe present invention supports a user of a visual inspection apparatuseasily for programming the visual inspection program used in the visualinspection apparatus and suitable for inspecting products conveyed on amanufacturing line.

[0040] In this embodiments, it is possible that the programmingapparatus is independent from the visual inspection apparatus.Alternatively, it is possible that the programming apparatus is includedin the visual inspection apparatus. In the former case, a program forprogramming the visual inspection program can be installed in a knownapparatus such as a personal computer or a dedicated apparatus describedbelow. In the latter case, a processing unit of the visual inspectionapparatus serves as the programming apparatus.

[0041]FIG. 1 shows a block diagram of the programming apparatus 20 inthe first embodiment. FIG. 2 visually shows the contents of each blockof the programming apparatus 20.

[0042] An input unit 1 is configured by a key board 11, a mouse 12 andso on, by which the user of the programming apparatus 20 can input, forexample, his judgment with respect to a result of a visual inspection,or his selection of parameters and image processing algorithms, and soon used in the visual inspection steps. A display unit 2 is configuredby a monitor display such as a CRT (Cathode Ray Tube apparatus) or a LCD(Liquid Crystal Display apparatus) for displaying visual images of theproducts to be inspected before and after the image processing, or fordisplaying a guidance of input operation for programming the visualinspection program.

[0043] An image data memory 3 is configured by a recording andreproducing apparatus for recording and reading the image data on andfrom a recording medium such as a hard disc, a magneto-optical disk (MOdisc) or a magnetic disc. The image data memory 3 memorizes the imagedata of defective units and non-defective units which are previouslytaken by the user with using an image acquisition unit 7. The imageacquisition unit 7 is configured by a camera 71 using an imageacquisition device such as CCD and a signal processor 72. Samples of thedefective units and the non-defective units of the products to beinspected are prepared by the user.

[0044] In the image data memory 3, hierarchical folders are provided.When the product to be inspected is a switch, a folder named “DEFECTIVE”for memorizing the image data of the defective units and a folder named“NON-DEFECTIVE” for memorizing the image data of the non-defective unitsare provided below a folder named “SWITCH”, as shown in FIG. 2.Furthermore, a plurality of folders named “CRACK” and so oncorresponding to the causes of the defective such as an occurrence of acrack, an extraneous matter, and so on are provided below the foldernamed “DEFECTIVE”.

[0045] An algorithm memory 4 is configured by a recording andreproducing apparatus for recording and reading the image data on andfrom a recording medium such as a hard disc, an MO disk or a magneticdisc. The algorithm memory 4 memorizes a plurality of image processingalgorithms (inspection items) used for inspection of tinted extraneousmatter, occurrence of crack, and so on with respect to each product tobe inspected. The image processing algorithms are selected by the userin the programming process of the visual inspection program suitable forthe inspection of the products.

[0046] A standard flow memory 5 is configured by a recording andreproducing apparatus for recording and reading the image data on andfrom a recording medium such as a hard disc, a magneto-optical disk or amagnetic disc. The standard flow memory 5 memorizes a plurality ofstandard inspection flows and inspection parameters respectivelysuitable for kinds of products to be inspected such as a switch, acircuit breaker or a receptacle. The standard inspection flows arepreviously prepared by, for example, a programmer in the vendor of thevisual inspection apparatus responding to the request of the user whowishes to inspect his products, visually. Details of the standardinspection program will be described below.

[0047] The image data memory 3, the algorithm memory 4 and the standardflow memory 5 can be configured by the same recording and reproducingapparatus. Alternatively, they can respectively be configured byindependent recording and reproducing apparatuses.

[0048] An inspection processor 6 is configured by a CPU (CentralProcessing Unit), a memory and a control program for controlling theprogramming apparatus of the visual inspection program. The inspectionprocessor 6 is used not only for controlling the elements of theprogramming apparatus 20 wholly, but also for executing the programmingsteps of the visual inspection program by the programming apparatus 20.

[0049] An output unit 8 is configured by a recording apparatus forrecording the visual inspection program programmed by the programmingapparatus 20 into a recording medium 81 such as a CD-R (Compact DiscRecordable), an MO disc, a floppy disc, or the like.

[0050]FIG. 3 shows examples of the kinds of the products to beinspected. The standard flow memory 5 memorizes the standard inspectionflows and the inspection parameters used in respective standardinspection flows corresponding to the lowest hierarchical names of theproducts. The kinds of the products are sorted corresponding to thematerials of the surface of the products at first stage. Furthermore,the kinds of the products are sorted corresponding to the use of theproducts at second stage. Still furthermore, the kinds of the productsare sorted by the trade name or the parts name of the products at thirdstage.

[0051]FIG. 4 shows an example of a guidance of programming stepsdisplayed on the monitor display of the display unit 2, when thestandard inspection flow suitable for visual inspection of the switch isread out from the standard flow memory 5. Since the guidance isdisplayed on the display unit 2, so that the user can serially input theimage data and select the inspection items and/or the inspectionparameters by following the instruction in the guidance.

[0052]FIG. 5 shows examples of the image data of the defective units ofthe switches. Three folders named “CRACK”, “CHIPPING” and “EXTRANEOUS”are provided below the folder “DEFECTIVE”. Image data of the samples ofthe defective units of the switches are taken by the user by using theimage acquisition unit 7 prior to the programming of the visualinspection program. The image data are sorted corresponding to the kindsof the defect and memorized in the folder corresponding to the defect.

[0053]FIG. 6 shows an example of the sorting of the image data of thedefective units and non-defective units. In this example, the image dataare further sorted corresponding to the degree of defects into thefolders named “MAJOR DEFECT”, “MIDDLE DEFECT”, “MINOR DEFECT”,“ACCEPTABLE”, “GOOD” and “SPLENDID”. The image data sorted into thefolder of acceptable has some defects but it is acceptable to beshipped. The image data sorted into the folder of good has a littledefect but the defect is no problem. The image data sorted into thefolder of splendid rarely has defect. It is possible to provide a foldernamed “PERFECT” (not shown in the figure) into which the image datahaving no defect is sorted. The image data sorted into the folder ofmajor defect, middle defect or minor defect has defects not acceptable.

[0054]FIG. 7 shows another example of sorting of the image datacorresponding to the illumination method when the image data of thesample of the defective units and non-defective units of the productsare taken. Three folders named “DIFFUSED ILLUMINATION”, “COAXIALILLUMINATION” and “OBLIQUE ILLUMINATION” are provided. When the sameobject is illuminated by different illumination methods, the image datataken under the different illumination method will be different at all.Furthermore, there is the most suitable illumination methodcorresponding to the specification of the products. The folders ofdefective units and non defective units are provided below therespective folders with respect to the illumination methods.

[0055]FIG. 8 shows examples of the surface nature or the materials ofthe products to be inspected. Generally, a convex and concave structureis formed on the surface of the product. When the convex and concavestructure on the surface of the product is sharp, shadows of the convexand concave structure will be observed according to the illuminationmethod. Alternatively, when the convex and concave structure on thesurface of the product is dull, edges of the convex and concavestructure cannot be observed according to the illumination method. Thus,the standard flow memory 5 memorizes several kinds of the standardinspection flows and inspection parameters corresponding to the convexand concave structure of the surface of the products. Furthermore, thesurface of the product is generally finished such as stain finish,mirror finish or lusterless corresponding to the surface nature ormaterial of the product. The standard flow memory 5 further memorizesseveral kinds of the standard inspection flows and inspection parameterscorresponding to the surface nature or material of the surface of theproducts.

[0056]FIG. 9 shows examples of surface colors of the products to beinspected. Generally, coloring such as white, ivory, black or the likeis provided on the surface of the products having the same shape fordifferentiating the products or for improving the appearance of theproducts. The image data of the product having the surface color ofwhite is clearly different from that having the surface color of blackeven though the products have the same shape and the image data aretaken under the same condition. Thus, the standard flow memory 5memorizes several kinds of the standard inspection flows and inspectionparameters corresponding to the surface colors of the surface of theproducts.

[0057] Subsequently, the programming steps of the visual inspectionprogram in the first embodiment is described with reference to a flowchart shown in FIGS. 10A and 10B.

[0058] When the program for programming the visual inspection programmemorized in the inspection processor 6 is started, the inspectionprocessor 6 displays a predetermined message on the display unit 2 whichrequires the user to input or to select a kind of product to beinspected (step S100). When the user inputs or selects the switch as theproduct to be inspected, the inspection processor 6 further requires theuser to select the illumination method for illuminating the product tobe inspected or to select the image acquisition condition for taking theimage data of the product on a manufacturing line (step S101). When theillumination method or image acquisition condition is selected, theinspection processor 6 still further requires the user to select thesurface nature and surface color of the switch (step S102).

[0059] When the kind of the product, the—illumination method, thesurface nature and the surface color of the product are inputted orselected by the user, the inspection processor 6 reads out a standardinspection flow suitable for inspecting the product from the standardflow memory 5 (step S103). When the standard inspection flow is readout, the inspection processor 6 displays a standard display, forexample, shown in FIG. 4 on the display unit 2 (step S104).

[0060] Subsequently, the inspection processor 6 requires the user toinput sample image data of the defective units and non defective unitsof the product (step S105). The sample image data is taken by the imageacquisition unit 7 at the time or prior to the programming of the visualinspection program. When the sample image data is inputted, theinspection processor 6 memorizes the sample image data into the imagedata memory 3 and further requires the user to select at least one imageprocessing algorithm such as inspection of occurrence of crack, adhesionof extraneous matter, occurrence of chipping, or the like (step S106).When at least one of the algorithm is selected, the inspection processor6 still further requires the user to select the inspection parameters(step S107). The inspection parameters includes a plurality of settingparameters used in the image processing steps and a plurality of judgingparameters used for judging whether the visual inspection result of theproduct is acceptable or not. The setting parameters are, for example, aregion to be inspected, and levels of the image processing such as thefiltering of the image data, the binary processing and the differentialprocessing.

[0061] An example for setting the parameter of the region to beinspected is described with reference to FIGS. 11A and 11B which showside views of the product such as the switch to be inspected. In FIG.11A, a pointer 100 having an arrow shape is moved to a position P1, forexample, disposed in the vicinity of the upper left end of the side faceof the switch by operating the mouse 12 of the input unit 1. While aswitch button of the mouse 12 is switched on, the pointer 100 is movedto a position P2 disposed in the vicinity of the lower right end of theside face of the switch. When the switch button of the mouse 12 isswitched off, a rectangular region 101 to be inspected is selected. Inthe region 101, an extraneous matter 102 which is the cause of thedefect is included. The shape of the region to be inspected, however, isnot restricted by the rectangle. It is possible to select an optionalshape such as a circle, an ellipse, a polygon, or the like suitable forinspecting the product.

[0062] When the inspection parameters are selected, a provisional visualinspection parameter is programmed. Thus, the inspection processor 6starts to execute the provisional visual inspection program. Theinspection processor 6 reads out the sample image data of the defectiveunits and the non-defective units of the product serially from the imagedata memory 3 (step S108). The inspection processor 6 executes the imageprocessing of the sample image data by following the provisional visualinspection program (step S109). When the image processing of the sampleimage data is completed, the inspection processor 6 displays an originalimage using the original image data and a processed image data using theprocessed image data on the display unit 2 (step S110).

[0063] Examples of the original image and the processed image displayedon the display unit 2 are shown in FIG. 12. As shown in FIG. 12, theoriginal image and the processed image are displayed on the same monitordisplay of the display unit at the same time. The original image isdisposed at the left side, and the processed image is disposed at theright hand. The extraneous matter 102A in the original image is blurred,but the extraneous matter 102B in the processed image is cleared.Displays of predetermined information data 103 and 104 are superimposedon the original image and the processed image. The information data 103with respect to the original image includes a file name such as “NG1”, aname of product such as “switch”, a kind of the product such as “SW1”, acause of the defects such as “extraneous matter” and a rank of thedefect such as “major defect”. The pointer 100 is further displayed onthe processed image for designating the portion of the defect such asthe extraneous matter 103B. The information data 104 with respect to theprocessed image includes a result of the inspection such as “NG”, anarea of the portion of the defect and the land number of the defects.

[0064] Subsequently, the inspection processor 6 executes the judgment ofthe visual inspection whether the appearance of the product has aunacceptable defect or not (step S111). The inspection processor 6repeats the steps S108 to S111 until the judgments with respect to allthe sample image data are completed (step S112).

[0065] When the judgments with respect to all the sample image data arecompleted, the inspection processor 6 displays the results of thejudgment on the display unit 2 (step S113). The user judges whether theresults of the judgments of the visual inspection of the sample imagedata of the product can be acceptable or not (step S114).

[0066] Hereupon, when the provisional visual inspection program isproperly programmed, the sample image data of the defective units of theproduct are judged to be unacceptable, and the sample image data of thenon-defective units are judged to be acceptable. On the other hand, whenthe provisional visual inspection program is improperly programmed, thesample image data of the defective units of the product are judged to beacceptable, or the sample image data of the non-defective units arejudged to be unacceptable. Thus, when the results of the visualinspection of the sample image data are not acceptable, the user inputsa predetermined command such as “NO” by using the input unit 1, and theinspection processor 6 returns to the step S106 for re-requiring theuser to select the image processing algorithm and the inspectionparameters again. The steps S106 to S113 will be repeated until theresults of the visual inspection of the sample image data becomesacceptable.

[0067] When the results of the visual inspection of the sample imagedata are acceptable, the user inputs a predetermined command such as“YES” by using the input unit 1, and the inspection processor 6 outputsthe provisional visual inspection program configured by the standardinspection flow and the selected image processing algorithms and theinspection parameters to the output unit 8 as a final visual inspectionprogram. The output unit 8 records the visual inspection program into arecording medium such as the CD-R, the MO disc, or the like (step S114).When the visual inspection program is outputted, the inspectionprocessor 6 completes the program for programming the image inspectionprogram.

[0068] In the above-mentioned flowchart, the position of the step forinputting the sample image data is not restricted by the description. Itis possible to input the sample image data at any time when the userwishes until the provisional visual inspection program is started. Thesame rule applies correspondingly to the following flowcharts.

[0069] As mentioned above, the user unaccustomed to the programminglanguage and/or image processing can easily program the visualinspection program suitable for the product to be inspected by using theprogramming apparatus in the first embodiment.

[0070] A first modification of the programming steps of the visualinspection program in the first embodiment is described with referenceto a flow chart shown in FIGS. 13A to 13C. In the followingmodifications which will be described below, the steps for displayingthe standard display on the display unit, for selecting the illuminationmethod, and for selecting the surface nature and the surface color ofthe product are omitted.

[0071] For example, when the product to be inspected is the switch, itis considered that the defects of the switch are caused by theoccurrence of the crack, scratch, chipping or the adhesion of extraneousmatters. In the first modification, the inspection items or the imageprocessing algorithms, the standard inspection flow and the inspectionparameters, or the combination of them, which are recommended by theexpert of the image processing, are previously programmed, andautomatically read out from the algorithm memory 4 and the standard flowmemory 5, when the user inputs or selects the kind of the product to beinspected.

[0072] When the program for programming the visual inspection programmemorized in the inspection processor 6 is started, the inspectionprocessor 6 displays a predetermined message on the display unit 2 whichrequires the user to input or to select the kind of product to beinspected (step S200). When the user selects the switch as the productto be inspected, the inspection processor 6 selects a standardinspection flow from the standard flow memory 5, at least one of theimage processing algorithm and the inspection parameters from thealgorithm memory 4 which are suitable for inspecting the product andrecommended by the expert (step S201).

[0073] When the standard inspection flow and so on are selected, theinspection processor 6 requires the user to input sample image data ofthe defective units and non defective units of the switch (step S202).When the sample image data are inputted, the inspection processor 6memorizes the sample image data into the image data memory 3.Subsequently, the inspection processor 6 starts the visual inspection byfollowing a provisional visual inspection program configured by theselected standard inspection flow, the image processing algorithms andthe inspection parameters (step S203).

[0074] The inspection processor 6 reads out the sample image data of thedefective units and the non-defective units of the product serially fromthe image data memory 3 (step S204). When one of the sample image datais read out, the inspection processor 6 executes the detection andlocation of the edges of the image using the sample image data in thehorizontal direction by following the provisional visual inspectionprogram (step S205). Subsequently, the inspection processor 6 executesthe detection and location of the edges of the image in the verticaldirection (step S206).

[0075] When the locations of the edges of the image in the horizontaland vertical directions are completed, the inspection processor 6executes the inspection of the occurrence of the crack (step S207), theoccurrence of the chipping (step S208), the adhesion of the extraneousmatters (step S209) and the occurrence of the scratch (step S210) withrespect to each surface of the product.

[0076] When the above-mentioned inspections are completed with respectto each sample image data, the inspection processor 6 executes thejudgment of the visual inspection whether the appearance of the producthas a defect unacceptable or not (step S211). When the judgment of thevisual inspection of the sample image is completed, the inspectionprocessor 6 judges whether the sample image data executed by theabove-mentioned inspections is non-defective or defective (step S212).

[0077] When the sample image data is non-defective, the inspectionprocessor 6 further judges whether the result of the judgment of thevisual inspection is non-defective or not (step S213). When the judgmentof the visual inspection is non-defective, the result of the judgmentcoincides with the nature of the sample image data, so that theinspection processor 6 judges the provisional visual inspection programconfigured by standard inspection flow, the image processing algorithmsand the inspection parameters is proper (or good) visually forinspecting the switch (step S214). Alternatively, when the judgment ofthe visual inspection is defective, the result of the judgment does notcoincide with the nature of the sample image data, so that thenon-defective unit will be lost by miss-judgment of the visualinspection. Thus, the inspection processor 6 judges the provisionalvisual inspection program is improper (no good) visually for inspectingthe switch (step S215).

[0078] When the sample image data is defective in the step S212, theinspection processor 6 further judges whether the result of the judgmentof the visual inspection is defective or not (step S216). When thejudgment of the visual inspection is defective, the result of thejudgment coincides with the nature of the sample image data, so that theinspection processor 6 judges the provisional visual inspection programis proper (good) visually for inspecting the switch (step S217).Alternatively, when the judgment of the visual inspection isnon-defective, the result of the judgment does not coincide with thenature of the sample image data, so that the defective unit will beincluded in the non-defective units by miss-judgment of the visualinspection. Thus, the inspection processor 6 judges the provisionalvisual inspection program is improper (no good) visually for inspectingthe switch (step S218).

[0079] When the provisional visual inspection program is judged properin the steps S214 and S217, the inspection processor 6 judges whetherthe visual inspections with respect to all the sample image data arecompleted or not (step S219). When all the sample data are not inspectedyet, the inspection processor 6 returns to the step S204 for repeatingthe steps S204 to S219 and S221 (described below) with respect to thenext sample image data. Alternatively, when all the sample data areinspected, the inspection processor 6 outputs the provisional visualinspection program configured by the standard inspection flow, theselected image processing algorithms and the inspection parameters to amemory of the visual inspection apparatus or records the provisionalvisual inspection program into a recording medium such as a CD-R, an MOdisc, or the like as the visual inspection program (step S220). When thevisual inspection program is outputted, the inspection processor 6completes the program for programming the image inspection program.

[0080] When the provisional visual inspection program is judged improperin the steps S215 and S218, the inspection processor 6 requires the userto change at least one image processing algorithms and/or at least oneinspection parameter (step S221), and returns to the step S207 forrepeating the steps S207 to S219 and S221 with respect to the samesample image data.

[0081] In the above-mentioned first modification, the combination of thestandard inspection flow, the image processing algorithms and theinspection parameters which are recommended by the expert of the imageprocessing is automatically selected when the user inputs or selects thekind of the product to be inspected, so that the user unaccustomed tothe programming language and the image processing can easily program thevisual inspection program suitable for the specific product to beinspected. Furthermore, the judgment whether the provisional visualinspection program configured by the standard inspection flow, the imageprocessing algorithms and the inspection parameters are proper orimproper visually for inspecting the product such as the switch selectedby the user is automatically judged by the program for programming thevisual inspection program. Thus, the user occasionally participates inthe programming processes for programming the visual inspection programsuitable for the specific product to be inspected.

[0082] A second modification of the programming steps of the visualinspection program in the first embodiment is described with referenceto a flow chart shown in FIGS. 14A to 14C. For simplifying thedescription of the second modification, only the occurrence of the crackis inspected as the inspection item. In the second modification, aplurality of the image processing algorithms with respect to the sameinspection item are prepared, and each image processing algorithm has aprecedence value. Furthermore, each sample data used for the visualinspection has an initial value of the precedence.

[0083] When the program for programming the visual inspection programmemorized in the inspection processor 6 is started, the inspectionprocessor 6 displays a predetermined message on the display unit 2 whichrequires the user to input or to select the kind of product to beinspected (step S300). When the user inputs or selects the switch as theproduct to be inspected, the inspection processor 6 selects a standardinspection flow from the standard flow memory 5, at least one of theimage processing algorithm and so on (step S301).

[0084] When the standard inspection flow and so on are selected, theinspection processor 6 requires the user to input sample image data ofthe defective units and non-defective units of the product and theinitial precedence with respect to each sample image data (step S302).When the sample image data and the initial precedence values areinputted, the inspection processor 6 memorizes the sample image data andthe initial precedence values into the image data memory 3.Subsequently, the inspection processor 6 starts a provisional visualinspection program configured by the standard inspection flow and so onfor inspecting the sample image data (step S303).

[0085] The inspection processor 6 reads out the sample image data of thedefective units and the non-defective units of the product serially fromthe image data memory 3 (step S304). When one of the sample image datais read out, the inspection processor 6 executes the detection andlocation of the edges of the image using the sample image data in thehorizontal and vertical directions (step S305).

[0086] When the locations of the edges of the image in the horizontaland vertical directions are completed, the inspection processor 6 readsout the initial precedence value “I” of the image data (step S306). Whenthe initial precedence value I=1, the inspection processor 6 reads outand executes the image processing algorithm such as a first crackinspection having the precedence value I=1 (step S307). When the initialprecedence value I=2, the inspection processor 6 reads out and executesthe image processing algorithm such as a second crack inspection havingthe precedence value I=2 (step S308).

[0087] When the above-mentioned crack inspection is completed, theinspection processor 6 executes the judgment of the visual inspectionwhether the appearance of the product has a defect unacceptable or not(step S309). When the judgment of the visual inspection of the sampleimage is completed, the inspection processor 6 judges whether the sampleimage data executed by the above-mentioned inspections is non-defectiveor defective (step S310).

[0088] When the sample image data is non-defective, the inspectionprocessor 6 further judges whether the result of the judgment of thevisual inspection is non-defective or not (step S311). When the judgmentof the visual inspection is non-defective, the result of the judgmentcoincides with the nature of the sample image data and the precedencevalue of the sample image data is proper, so that the inspectionprocessor 6 judges the provisional visual inspection program configuredby the standard inspection flow, the image processing algorithms and theinspection parameters is proper (good) visually for inspecting theproduct (step S312). Alternatively, when the judgment of the visualinspection is defective, the result of the judgment does not coincidewith the nature of the sample image data, so that the non-defective unitwill be lost by miss-judgment of the visual inspection due to theimproper precedence value of the sample image data. Thus, the inspectionprocessor 6 judges the provisional visual inspection program is improper(no good) visually for inspecting the product (step S313).

[0089] When the sample image data is defective in the step S310, theinspection processor 6 further judges whether the result of the judgmentof the visual inspection is defective or not (step S314). When thejudgment of the visual inspection is defective, the result of thejudgment coincides with the nature of the sample image data, so that theinspection processor 6 judges the provisional visual inspection programis proper (good) visually for inspecting the product (step S315).Alternatively, when the judgment of the visual inspection isnon-defective, the result of the judgment does not coincide with thenature of the sample image data, so that the defective unit will beincluded in the non-defective units by miss-judgment of the visualinspection. Thus, the inspection processor 6 judges the provisionalvisual inspection program is improper (no good) visually for inspectingthe product (step S316).

[0090] When the standard inspection flow is judged proper in the stepsS312 and S315, the inspection processor 6 judges whether the visualinspections with respect to all the sample image data are completed ornot (step S317). When all the sample data are not inspected yet, theinspection processor 6 returns to the step S304 for repeating the stepsS304 to S317 and S319 to S322 (described below) with respect to the nextsample image data. Alternatively, when all the sample data areinspected, the inspection processor 6 outputs the provisional visualinspection program configured by the standard inspection flow, theselected image processing algorithms and the inspection parameters to amemory of the visual inspection apparatus or records the visualinspection program into a recording medium such as a CD-R, an MO disc,or the like as a final visual inspection program (step S318). When thevisual inspection program is outputted, the inspection processor 6completes the program for programming the image inspection program.

[0091] When the provisional visual inspection program is judged improperin the steps S313 and S316, the inspection processor 6 inquires the userto change the precedence value or not (step S319). When the user wishesto change the precedence value, the inspection processor 6 requires theuser to change the precedence value of the sample image data (stepS320). When the user does not wish to change the precedence value (NO inthe step S319) or when the precedence value is changed in the step S320,the inspection processor 6 further inquires the user to change theinspection parameters (step S321). When the user wishes to change theinspection parameters, the inspection processor 6 requires the user tochange the inspection parameters (step S322). When the user does notwish to change the inspection parameters (NO in the step S321) or whenthe inspection parameters are changed in the step S322, the inspectionprocessor 6 returns to the step S306 for repeating the steps S306 toS317 and S319 to S322 with respect to the same sample image data.

[0092] In the above-mentioned second modification, the precedence is setto the image processing algorithms included in the same criteria, andthe user can select the most suitable image processing algorithmvisually for inspecting the product to be inspected.

[0093] In the second modification, the image processing algorithms havethe precedence. FIG. 15 shows another modification that the inspectionparameters have the precedence. FIG. 15 is a table for showing theexample of the inspection parameters, which is displayed on the displayunit 2. The precedence of each parameter shows the degree that thevariation of the values of the parameter effects the result of the imageprocessing of the image data. In the table shown in FIG. 15, the symbol“+” designates that the value of the parameter is increased from thecurrent value, and the symbol “−” designates that the value of theparameter is decreased from the current value.

[0094] In this example, when a result of a visual inspection of a sampleimage data inspected by a standard inspection flow with previouslyselected image processing algorithms and inspection parameters is notacceptable, the parameter having the precedence value “1 ” such as thethreshold value of the edge detection will be varied from the initialvalue “50” by the predetermined width “52 in both of increasing anddecreasing directions between the limitation values “2” to “100”. Thethreshold value of the edge detection will be varied as50→55→45→60→40→65→35 . . . Similarly, the threshold value of the edgeextension will be varied as 30→35→25→40→20→45→15 . . .

[0095] By such a configuration, the user can easily change theinspection parameters by following the precedence, when the provisionalvisual inspection program is judged improper.

[0096] A third modification of the programming steps of the visualinspection program in the first embodiment is described with referenceto a flow chart shown in FIGS. 16A to 16C. In the third modification,the provisional visual inspection program configured by the standardinspection flow, the image processing algorithms and the inspectionparameters is evaluated by number of occurrence of miss-judgment of thevisual inspection of the sample image data.

[0097] When the program for programming the visual inspection programmemorized in the inspection processor 6 is started, the inspectionprocessor 6 displays a predetermined message on the display unit 2 whichrequires the user to input or to select the kind of product to beinspected (step S400). When the user inputs or selects the switch as theproduct to be inspected, the inspection processor 6 selects a standardinspection flow from the standard flow memory 5 (step S401).

[0098] When the standard inspection flow is selected, the inspectionprocessor 6 requires the user to input sample image data of thedefective units and non-defective units of the product (step S402). Whenthe sample image data are inputted, the inspection processor 6 memorizesthe sample image data into the image data memory 3. Subsequently, theinspection processor 6 requires the user to select at lest one imageprocessing algorithm (step S403), and to select the inspectionparameters (step S404).

[0099] Subsequently, the inspection processor 6 reads out the sampleimage data of the defective units and the non-defective units of theproduct serially from the image data memory 3 (step S405). When one ofthe sample image data is read out, the inspection processor 6 executesthe provisional visual inspection program such as the detection andlocation of the edges of the image using the sample image data in thehorizontal and vertical directions, the filtering process, and so on(step S406).

[0100] When the image processing is completed, the inspection processor6 displays the original image and the processed image on the displayunit 2 (step S407). Simultaneously, the inspection processor 6 executesthe judgment of the visual inspection whether the appearance of theproduct has a defect unacceptable or not (step S408). When the judgmentof the visual inspection of the sample image is completed, theinspection processor 6 judges whether the sample image data executed bythe above-mentioned inspections is non-defective or defective (stepS409).

[0101] When the sample image data is non-defective, the inspectionprocessor 6 further judges whether the result of the judgment of thevisual inspection is non-defective or not (step S410). When the judgmentof the visual inspection is non-defective, the result of the judgmentcoincides with the nature of the sample image data, so that theinspection processor 6 judges the provisional visual inspection programconfigured by the standard inspection flow, the image processingalgorithms and the inspection parameters is proper (good) visually forinspecting the product (step S411). Furthermore, the inspectionprocessor 6 increases a count of a first counter by one (step S412).Alternatively, when the judgment of the visual inspection is defective,the result of the judgment does not coincide with the nature of thesample image data, so that the non-defective unit will be lost bymiss-judgment of the visual inspection (step S413). The inspectionprocessor 6 increases a count of a second counter by one (step S414).

[0102] When the sample image data is defective in the step S409, theinspection processor 6 further judges whether the result of the judgmentof the visual inspection is defective or not (step S415). When thejudgment of the visual inspection is defective, the result of thejudgment coincides with the nature of the sample image data, so that theinspection processor 6 judges whether the provisional visual inspectionprogram is proper (good) visually for inspecting the product (stepS416). The inspection processor 6 increases a count of a third counterby one (step S417). Alternatively, when the judgment of the visualinspection is non-defective, the result of the judgment does notcoincide with the nature of the sample image data, so that the defectiveunit will be mixed in the non-defective units by miss-judgment of thevisual inspection (step S418). The inspection processor 6 increases acount of a fourth counter by one (step S419).

[0103] When the count of any of the first to fourth counters isincreased, the inspection processor 6 judges whether the visualinspections with respect to all the sample image data are completed ornot (step S420). When all the sample data are not inspected yet, theinspection processor 6 returns to the step S405 for repeating the stepsS405 to S420 with respect to the next sample image data. Alternatively,when all the sample data are inspected, the inspection processor 6displays the counts of the first to fourth counters in a table on thedisplay unit 2 (step S421). Simultaneously, the inspection processor 6requires the user whether the results of the counts of the first tofourth counters that is the result of the visual inspection of thesample image data is acceptable or not (step S422).

[0104] When the user judges that the result of the visual inspection ofthe sample image data is acceptable, the user inputs a predeterminedcommand such as “YES” by using the input unit 1. The inspectionprocessor 6 outputs the provisional visual inspection program configuredby the standard inspection flow, the selected image processingalgorithms and the inspection parameters to a memory of the visualinspection apparatus or records the visual inspection program into arecording medium such as a CD-R, an MO disc, or the like as the visualinspection program (step S423). When the visual inspection program isoutputted, the inspection processor 6 completes the program forprogramming the image inspection program.

[0105] Alternatively, when the user judges that the result of the visualinspection of the sample image data is not acceptable, the user inputs apredetermined command such as “NO” by using the input unit 1. Theinspection processor 6 inquires the user to change at least oneinspection parameter (step S424). When the user wishes to change theinspection parameter, the inspection processor 6 displays apredetermined message for requesting the user to change the inspectionparameters, and the inspection processor 6 changes the inspectionparameter responding to the instruction of the user (step S425).Subsequently, the inspection processor 6 returns to the step S406 forrepeating the steps S406 to S420 with respect to the same sample imagedata.

[0106] In the above-mentioned third modification, the user can be judgedwhether the visual inspection program is acceptable or not by referringto the counts of the counters showing the ratio of the number of themiss-judgment with respect to the number of the proper judgment. Forexample, even when the miss-judgment for judging the non-defective unitsas the defective units occasionally occurs, the visual inspectionprogram is acceptable while the defective units never included in thenon-defective units. Alternatively, even when the miss-judgment forjudging the defective units as the non-defective units rarely occurs,the visual inspection program is not acceptable while at least onedefective unit is included in the non-defective units.

[0107] An example of a table of the judgment of the visual inspection ofthe sample image data and the ratio of the number of the miss-judgmentwith respect to the number of the proper judgment is shown in FIG. 17.

[0108] In FIG. 17, the upper half portion of the table shows theinspection result that seven non-defective sample image data areinspected by image processing algorithms for inspecting the occurrenceof the crack, the occurrence of the chipping, the adhesion of theextraneous matter and the occurrence of the scratch, and the lower halfportion of the table shows the inspection result that four defectivesample image data caused by the occurrence of the crack and threedefective sample image data caused by the adhesion of the extraneousmatter are inspected by the same image processing algorithms. The boxesdisposed at right hand of the boxes named “CRACK”, “CHIPPING”,“EXTRANEOUS MATTER” and “SCRATCH” designate the inspection results ofthe sample image data by using the image processing algorithms suitablefor inspecting the named defects.

[0109] In the upper half portion of the table with respect tonon-defective sample image data, the symbol “∘” designates that thenon-defective sample image data are judged non-defective, and the symbol“×” designates that the non-defective sample image data is judgeddefective. In the lower half portion of the table with respect to thedefective sample image data, the symbol “∘” designates that thedefective sample image data are judged defective, and the symbol “×”designates that the defective sample image data is judged non-defective.

[0110] For example, the symbol “×” in the box B1 shows that theprocessed image of the third non-defective sample image data after theimage processing by the image processing algorithm suitable for theinspection of the occurrence of the chipping was judges defective.Similarly, the symbol “×” in the box B2 shows that the processed imageof the sixth non-defective sample image data after the image processingby the image processing algorithm suitable for the inspection of theoccurrence of the scratch was judges defective. As mentioned above, itis acceptable that the non-defective units are occasionally removed fromthe manufacture line as defective.

[0111] On the other hand, the symbol “×” in the box B3 shows that theprocessed image of the third defective sample image data caused by theoccurrence of the crack after the image processing by the imageprocessing algorithm suitable for the inspection of the occurrence ofthe crack was judges non-defective. Similarly, the symbol “×” in the boxB4 shows that the processed image of the second defective sample imagedata caused by the adhesion of the extraneous matter after the imageprocessing by the image processing algorithm suitable for the inspectionof the occurrence of the crack was judges non-defective.

[0112] The visual inspection program used in the visual inspection ofthe sample image data has a problem that the defect caused by theoccurrence of the crack cannot be sensed by the image processingalgorithm suitable for inspection of the occurrence of the crack. It isnecessary to change the inspection algorithm and/or the inspectionparameters so as to judge the processed image of the third defectivesample image data caused by the occurrence of the crack after the imageprocessing by the image processing algorithm suitable for the inspectionof the occurrence of the crack as defective or “∘” in the box B3.

[0113] Furthermore, it is possible to configure the visual inspectionprogram in a manner so that the original image and the processed imagecan be displayed on the display unit 2 as shown in FIG. 12, when adesired box, for example, the box B5 is selected by the pointer 100.

[0114] In the above-mentioned third embodiment, the inspection processor6 displays the counts of the first to fourth counters in the table, forexample, shown in FIG. 17 on the display unit 2 in the step S421, andrequires the user whether the results of the counts of the first tofourth counters that is the result of the visual inspection of thesample image data is acceptable or not in the step S422. It, however, ispossible to configure the flowchart in a manner so that target values ofthe counts of the first to fourth counters are previously set as theinspection parameters; the counts of the first to fourth counters arecompared with the target values; when the counts of the first to fourthcounters satisfy predetermined conditions, the inspection processor 6can judge the provisional visual inspection program proper; and when thecounts of the first to fourth counters do not satisfy predeterminedconditions, the inspection processor 6 changes the inspection parametersby following the precedence until the counts of the first to fourthcounters satisfy predetermined conditions. By such a configuration, thevisual inspection program can substantially automatically programmedwithout the selection of the inspection parameters by the user.

[0115] A second embodiment of the present invention is described. FIG.18 shows a block diagram of a system configured by a programmingapparatus 21 of the visual inspection program and a visual inspectionapparatus 30. In comparison with FIG. 18 and FIG. 1, the programmingapparatus 21 in the second embodiment comprises a data communicationinterface 9 further to the configuration of the programming apparatus 20in the first embodiment.

[0116] The data communication interface 9 is communicated with a datacommunication inter face 31 of the visual inspection apparatus 30 by awired or wireless data communication system 40, such as a serial datacommunication system, a parallel data communication system or a LAN(Local Area Network). The inspection processor 6 further includes afunction to output the visual inspection program to the datacommunication interface 9.

[0117] By such a configuration, the visual inspection program programmedby the programming apparatus 21 can be installed into the visualinspection apparatus 30 independently provided from the programmingapparatus 21 without using any recording medium. Furthermore, the sameprogramming apparatus 21 can commonly be used for programming the visualinspection programs for a plurality of the visual inspection apparatuses30.

[0118] Alternatively, the user having the visual inspection apparatus 30but no programming apparatus can use the programming apparatus 21 of thevender of the visual inspection apparatus via the data communicationsystem 40, so that he can obtain the visual inspection program suitablefor inspecting the product which he wishes to inspect.

[0119] A third embodiment of the present invention is described. FIG. 19shows a block diagram of a visual inspection apparatus 32 having afunction of a programming apparatus of the visual inspection program. Incomparison with FIG. 19 and FIG. 1, the visual inspection apparatus 32in the third embodiment comprises an image acquisition unit 7, a visualinspection program memory 15 and a removing unit 16 further to theconfiguration of the programming apparatus 20 in the first embodiment.The function of the programming apparatus in the third embodiment issubstantially the same as one of the programming apparatus in theabove-mentioned embodiments, so that the detailed description of thefunction of the programming apparatus is omitted.

[0120] The image acquisition unit 7 is substantially the same as thatillustrated in FIG. 2, and used not only for taking the sample imagedata used in the programming steps of the visual inspection program butalso for taking visual images of the products conveyed on themanufacturing line in the actual visual inspection of the products. Theinspection program memory 15 is a non-volatile memory such as a harddisc or an EE-PROM (electrically Erasable-Programmable Read Only Memory)for memorizing the visual inspection program programmed by the functionof the programming apparatus. The removing unit 16 includes a mechanismsuch as a removing arm for removing a defective unit of the productsfrom the manufacturing line when the unit is judged as defective byfollowing the visual inspection program. It, however, is possible thatthe removing unit 16 instructs or marks the defective unit to be removedin a downstream portion in the manufacturing line.

[0121] When the programming of the visual inspection program iscompleted, the inspection processor 6 memorizes the visual inspectionprogram into the visual inspection program memory 15. For executing thevisual inspection of the products conveyed in the manufacturing line,the inspection processor 6 reads out the visual inspection program fromthe visual inspection memory 15 and executes the visual inspection withrespect to each image data of the product taken by the image acquisitionunit 7 one by one and judges whether the appearance of the product isacceptable or not. When the appearance of the product is judgeddefective, the inspection processor 6 controls the removing unit 16 forremoving the product from the manufacturing line.

[0122] By such a configuration, the visual inspection apparatus includesthe programming apparatus of the visual inspection program, so that theuser of the visual inspection apparatus can easily program the visualinspection program suitable for inspecting the product which the userwishes to inspect.

[0123] Industrial Applicability

[0124] As mentioned above, the user of the visual inspection apparatuscan easily program the visual inspection program suitable for inspectingthe products which the user wishes to inspect by following the guidancedisplayed on the monitor display of the display unit of the programmingapparatus of the visual inspection program in accordance with thepresent invention, even though the user is unaccustomed to theprogramming language and/or the image processing. Furthermore, theprovisional visual inspection program programmed by the programmingapparatus is evaluated by actually inspecting the sample image dataincluding the defective units and the non-defective units of theproduct, so that the reliability and the accuracy of the visualinspection can be increased. Especially, when the result of theevaluation of the provisional visual inspection program is improper, itis possible to compensate the provisional visual inspection program bychanging at least one image processing algorithm and/or at least oneinspection parameter until the evaluation of the provisional visualinspection program becomes proper. Finally, the provisional visualinspection program evaluated proper is outputted as the visualinspection program, so that the result of the visual inspection of theproducts conveyed on the manufacturing line by the visual inspectionapparatus using the visual inspection program rarely includes erroneouscomponent.

1. A programming apparatus of a visual inspection program comprising: animage data memory for memorizing a plurality of sample image data ofdefective units and non-defective units of an object to be inspectedwhich are previously prepared by a user; an algorithm memory formemorizing a plurality of image processing algorithms with respect toeach inspection item; a standard flow memory for memorizing at least onestandard inspection flow and a plurality of inspection parameters withrespect to each kind of object to be inspected; a display unit having amonitor display for displaying at least a guidance of programming steps;an input unit by which a user inputs or selects a kind of an objectwhich he wished to inspect, and selects at least one image processingalgorithm and at least one inspection parameter; and an inspectionprocessor for displaying the guidance of the programming steps,automatically selecting a standard inspection flow from the standardflow memory corresponding to the input or selection of the kind of theobject by the user, reading at least one image processing algorithm fromthe algorithm memory and at least one inspection parameter from thestandard flow memory corresponding to the selection by the user,programming a provisional visual inspection program by using thestandard inspection flow, the image processing algorithm(s) and theinspection parameter(s), processing the sample image data of defectiveunits and non-defective units by following the provisional visualinspection program, executing the visual inspection whether anappearance of the object with respect to each sample image data isdefective or non-defective using processed image data, displayingresults of the visual inspection of the sample image data on the monitordisplay of the display unit, requiring the user whether the provisionalvisual inspection program is proper or improper, and outputting theprovisional visual inspection program as a final visual inspectionprogram when the user judges the provisional visual inspection programis proper.
 2. The programming apparatus in accordance with claim 1,wherein the inspection processor further requires the user to change atleast one image processing algorithm and/or at least one inspectionparameter when the user judges the provisional visual inspection programis improper.
 3. The programming apparatus in accordance with claim 2,wherein the inspection processor repeats to require the user to changeat least one image processing algorithm and/or at least one inspectionparameter until the provisional visual inspection program is judgedproper.
 4. The programming apparatus in accordance with one of claims 1to 3, wherein the image data memory memorizes with each sample imagedata of the defective units with an information of a cause of defect. 5.The programming apparatus in accordance with one of claims 1 to 3,wherein the sample image data of the defective units and non-defectiveunits are respectively sorted in the image data memory corresponding todegree of defect and degree of quality.
 6. The programming apparatus inaccordance with one of claims 1 to 3, wherein the sample image data ofthe defective units and non-defective units are sorted in the image datamemory corresponding to illumination methods or condition when thesample image data are taken.
 7. The programming apparatus in accordancewith one of claims 1 to 6, wherein the standard flow memory memorizesthe standard inspection flow with at least one inspection parametercorresponding to a surface nature or a material of the object.
 8. Theprogramming apparatus in accordance with one of claims 1 to 6, whereinthe standard flow memory memorizes the standard inspection flow with atleast one inspection parameter corresponding to a surface color of theobject.
 9. The programming apparatus in accordance with one of claims 1to 6, wherein the standard flow memory memorizes a combination of astandard inspection flow, at least one image processing algorithm and atleast one inspection parameter recommended by an expert with respect toeach kind of the object.
 10. The programming apparatus in accordancewith one of claims 1 to 6, wherein the standard flow memory memorizes acombination of a standard inspection flow, a plurality of imageprocessing algorithms and at least one inspection parameter withprecedence of the image processing algorithm recommended by an expertwith respect to each kind of the object.
 11. The programming apparatusin accordance with one of claims 1 to 6, wherein the standard flowmemory memorizes a combination of a standard inspection flow, at leastone image processing algorithm and a plurality of inspection parameterswith precedence of the inspection parameters recommended by an expertwith respect to each kind of the object.
 12. The programming apparatusin accordance with one of claims 1 to 6, wherein the standard flowmemory memorizes an initial value of each inspection parameter, a widthand directions for changing the value of each inspection parameter, andan upper limit and a lower limit of a region in which the value of eachinspection parameter is varied.
 13. The programming apparatus inaccordance with one of claims 1 to 12, the inspection processor comparesthe result of the visual inspection with respect to each sample imagedata with defective or non-defective of the sample image data used inthe visual inspection, counts a number of the result of the inspectioncoinciding with the defective or non-defective of the sample image data,and repeats the visual inspection of the sample image data with changingthe inspection parameter(s) until the counted number reaches to apredetermined value.
 14. The programming apparatus in accordance withone of claims 13, the inspection processor repeatedly requires the userto change the inspection parameter(s) until the number reaches to apredetermined value.
 15. The programming apparatus in accordance withone of claims 1 to 13, wherein the inspection processor further displaysat least one image using a sample image data on the monitor display ofthe display unit.
 16. The programming apparatus in accordance with claim15, wherein a region to be inspected on a surface of the object isselected by pointing at least two points by using the input unit whilethe image of the object is displayed on the monitor display of thedisplay unit.
 17. The programming apparatus in accordance with claim 15,wherein the inspection processor displays images before and after theimage processing of each sample image data on the monitor display of thedisplay unit.
 18. The programming apparatus in accordance with one ofclaims 1 to 13, wherein the inspection processor further displays atable for showing the visual inspection results with respect to all thesample image data on the monitor display of the display unit.
 19. Theprogramming apparatus in accordance with claim 18, wherein theinspection processor displays images before and after the imageprocessing of a sample image data with the table on the monitor displayof the display unit when the user selects a point on the monitor displaycorresponding to the sample data he selects.
 20. The programmingapparatus in accordance with one of claims 1 to 19, further comprising adata communication unit for outputting the visual inspection program toan external visual inspection apparatus.
 21. The programming apparatusin accordance with one of claims 1 to 19, further comprising a recordingapparatus for recording the visual inspection program in a recordingmedium.
 22. The programming apparatus in accordance with claim 1 to 21,further comprising an image acquisition apparatus for taking the sampleimage data.
 23. A visual inspection apparatus comprising: an imageacquisition unit for taking an image data of an object conveyed on amanufacturing line thereof; an visual inspection unit for processingpredetermined image processing to the image data taken by the imageacquisition unit and for judging whether an appearance of the object isdefective or non-defective by following a visual inspection program; aremoving unit for removing the object or for instructing to remove theobject judged defective from the manufacturing line; and a visualinspection programming unit for programming a visual inspection programsuitable for inspecting the object, wherein the visual inspectionprogramming unit further comprising: an image data memory for memorizinga plurality of sample image data of defective units and non-defectiveunits of the object to be inspected which are previously prepared by auser; an algorithm memory for memorizing a plurality of image processingalgorithms with respect to each inspection item; a standard flow memoryfor memorizing at least one standard inspection flow and a plurality ofinspection parameters with respect to each kind of the object to beinspected; a display unit having a monitor display for displaying atleast a guidance of programming steps; an input unit by which a userinputs or selects a kind of an object which he wished to inspect, andselects at least one image processing algorithm and at least oneinspection parameter; and an inspection processor for displaying theguidance of the programming steps, automatically selecting a standardinspection flow from the standard flow memory corresponding to the inputor selection of the kind of the object by the user, reading at least oneimage processing algorithm from the algorithm memory and at least oneinspection parameter from the standard flow memory corresponding to theinput or selection by the user, programming a provisional visualinspection program by using the standard inspection flow, the imageprocessing algorithm(s) and the inspection parameter(s), processing thesample image data of defective units and non-defective units byfollowing the provisional visual inspection program, executing thevisual inspection whether an appearance of the object with respect toeach sample image data is defective or non-defective using processedimage data, displaying results of the visual inspection of the sampleimage data on the monitor display of the display unit, requiring theuser whether the provisional visual inspection program is proper orimproper, and outputting the provisional visual inspection program as afinal visual inspection program when the user judges the provisionalvisual inspection program is proper.
 24. A method for programming avisual inspection program comprising the steps of: memorizing aplurality of image processing algorithm with respect to each inspectionitem, at least one standard inspection flow and a plurality ofinspection parameters with respect to each kind of object to beinspected which are previously prepared by a vendor of a visualinspection apparatus; requiring the user to input or to select a kind ofthe object to be inspected; requiring the user to input a plurality ofsample image data of defective units and non-defective units of theobject to be inspected; automatically selecting a standard inspectionflow corresponding to the kind of the object among the previouslymemorized standard inspection flows; requiring the user to select atleast one image processing algorithms and at least one inspectionparameter among the previously memorized image processing algorithms andthe inspection parameters by following the selected standard inspectionflow; programming a provisional visual inspection program using theselected standard inspection flow, the image processing algorithm(s) andthe inspection parameter(s); reading out the sample image data one byone; executing visual inspection of the sample image data by followingthe provisional visual inspection program; executing the visualinspection with respect to each sample image data whether an appearanceof the object is defective or non-defective; and displaying the resultof the judgment of the visual inspection of the sample image data on amonitor display.
 25. A program for programming the visual inspectionprogram comprising the steps of: requiring a user to input or to selecta kind of an object to be inspected; automatically selecting a standardinspection flow among a plurality of standard inspection flowspreviously inputted corresponding to the input or selection of the kindof the object by the user; requiring the user to input at plurality ofsample image data of the object including at least one defective unitand at least one non-defective unit; requiring the user to select atleast one image processing algorithm and at least one inspectionparameter among a plurality of image processing algorithms and aplurality of inspection parameters previously inputted; programming aprovisional visual inspection program using the selected standardinspection flow, the image processing algorithm(s) and the inspectionparameter(s); reading the sample image data one by one; executing thevisual inspection with each sample image data by following theprovisional visual inspection program; judging whether the sample imagedata is defective or non-defective; and displaying the result of thejudgment with respect to all the sample image data on a monitor display.26. A recording medium memorizing at least one standard inspection flowwith respect to each kind of object to be inspected, a plurality ofimage processing algorithm with respect to each inspection item, aplurality inspection parameters and a program for programming a visualinspection program, wherein the program comprises the steps of:requiring a user to input or to select a kind of the object to beinspected; requiring the user to input a plurality of sample image dataof defective units and non-defective units of objects to be inspectedwhich are previously prepared by a user; automatically selecting astandard inspection flow corresponding to the kind of the object amongthe previously memorized standard inspection flows; requiring the userto select at least one image processing algorithms and at least oneinspection parameter among the previously memorized image processingalgorithms and the inspection parameters by following the selectedstandard inspection flow; programming a provisional visual inspectionprogram using the selected standard inspection flow, the imageprocessing algorithm(s) and the inspection parameter(s); reading out thesample image data one by one for executing visual inspection byfollowing a provisional visual inspection program configured by theelected standard inspection flow, the image processing algorithm(s) andthe inspection parameter(s); executing the visual inspection withrespect to each sample image data whether an appearance of the object isdefective or non-defective by following the provisional visualinspection program; and displaying the result of the judgment of thevisual inspection of the sample image data on the monitor display.